package edu.hawaii.myisern.action;

import java.io.IOException;
import java.net.MalformedURLException;
import junit.framework.TestCase;

import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.SAXException;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;

/**
 * Tests the Main Menu ActionBean class
 * 
 * @author Sonwright M. Gomez
 *
 */
public class TestIndexActionBean extends TestCase {

  /** Get the test host. */
  private String testHost = System.getProperty("test.host");
  
  /**
   * Tests the Main menu action bean.
   * 
   * @throws SAXException if error occurs with xml parser. 
   * @throws MalformedURLException if error occurs with URL.
   * @throws IOException if error occurs with IO.
   */
  @Ignore @Test
  public void testIndex () throws SAXException, MalformedURLException, IOException {
  WebConversation conversation = new WebConversation();

  String pageTitle = "MyIsern - Login";
 
    String Url = testHost + "myisern-onyx/index.jsp";
    WebResponse response = conversation.getResponse(Url);
    assertNotSame("Checking addCollaboration.jsp retrieval", pageTitle, response.getTitle());
    
    IndexActionBean iab = new IndexActionBean();
    iab.setPassword("password");
    iab.setUsername("username");
    iab.setErrorMessage("ERROR");
    assertSame("password same", "password", iab.getPassword());
    assertSame("username same", "username", iab.getUsername());
    assertSame("ERROR same", "ERROR", iab.getErrorMessage());
  }
  
}
